package doantotnghiep.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import doantotnghiep.dao.MedicamentDao;
import doantotnghiep.model.Medicament;

public class MedicamentBusiness {

	@Autowired
	private MedicamentDao medicamentDao;
	
	public Medicament getMedicamentById(int id) {
		Medicament medicament;
		medicament = medicamentDao.findMedicamentByID(id);
		return medicament;
	}
	
	public List<Medicament> listMedicament() {
			return medicamentDao.listMedicament();
	}
	
	public void addMedicament(Medicament medicament) {
	   medicamentDao.addMedicament(medicament);		
	}
	public void saveMedicamentChanged(Medicament medicament){
		medicamentDao.saveMedicament(medicament);		
	}

	public void deleteMedicament(int id) {
        medicamentDao.deleteMedicament(id);		
	}

	public List<Medicament> getMedicamentByKeyWord(String key) {
		return medicamentDao.getMedicamentByKey(key);
	}

	public void increaseNumberOfBatchofMedicine(int medicamentID, int i) {
		medicamentDao.increaseNumberOfBatchofMedicine(medicamentID,i);
	}

	public List<Medicament> getAllMedicamentByKeyWord(String key) {
		return medicamentDao.getMedicamentByKey(key);
	}

	public void decreaseNumberofBatch(int medicament_ID, int totalBatch) {
		medicamentDao.decreaseNumberofBatch( medicament_ID, totalBatch);
		
	}
}
